<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
	<TITLE>Readme for hello example</TITLE>
	<META NAME="GENERATOR" CONTENT="OpenOffice.org 2.0  (Linux)">
	<META NAME="CREATED" CONTENT="20060627;17353000">
	<META NAME="CHANGEDBY" CONTENT="kejin">
	<META NAME="CHANGED" CONTENT="20070602;11324000">
	<STYLE TYPE="text/css">
	<!--
		@page { size: 8.5in 11in }
		P { color: #000000 }
		H2 { color: #000000 }
		H3 { color: #000000 }
		PRE { color: #000000 }
		A:link { color: #0000ff }
		A:visited { color: #990066 }
	-->
	</STYLE>
</HEAD>
<BODY LANG="en-US" TEXT="#000000" LINK="#0000ff" VLINK="#990066" BGCOLOR="#ffffff" DIR="LTR">
<H2>PocoCapsule/C++ example: CORBA Hello using TIE</H2>
<P>Copyright(c) 2006 by <A HREF="http://www.pocomatic.com/">Pocomatic
Software</A>. All rights reserved.</P>
<P>This example is similar to the <A HREF="../hello/README.html">hello</A>
example, except, the Server implementation uses TIE mechanism instead
of skeleton inheritance. 
</P>
<H3>Source Files</H3>
<P STYLE="margin-bottom: 0in"><A HREF="Greeting.idl">Greeting.idl:</A>
This is the IDL definition of the server's remote interface<B>.</B> 
</P>
<UL>
	<LI><P STYLE="margin-bottom: 0in"><FONT SIZE=2>This interface only
	declares one operation, <I><FONT FACE="Nimbus Sans L">string
	hello(in string s)</FONT></I>. <FONT FACE="Nimbus Roman No9 L">A
	client can invoke this operation to send a greeting message to
	server, and receive a reply greeting from server, as the return
	value. </FONT></FONT>
	</P>
</UL>
<P STYLE="margin-bottom: 0in"><A HREF="server.C">server.C:</A> This
is a simple container, used to deploy the server corba application
context. 
</P>
<P STYLE="margin-bottom: 0in"><A HREF="client.C">client.C:</A> This
is the client application. 
</P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; font-weight: medium"><FONT FACE="Nimbus Roman No9 L"><FONT SIZE=2>The
	client application assume the server IOR or URL is provided as the
	first main() argument. The string IOR or URL is converted into an
	CORBA object reference using ORB's string_to_object(), </FONT></FONT>
	</P>
	<LI><P STYLE="margin-bottom: 0in; font-weight: medium"><FONT FACE="Nimbus Roman No9 L"><FONT SIZE=2>and
	then, this reference is narrowed to the type specific client stub
	class, namely, the <I><FONT FACE="Nimbus Sans L">sample::Greeting_ptr</FONT></I>.
	</FONT></FONT>
	</P>
</UL>
<P STYLE="margin-bottom: 0in"><SPAN STYLE="font-weight: medium"><FONT SIZE=3><FONT FACE="DejaVu Sans, sans-serif"><A HREF="GreetingImpl.h">GreetingImpl.h</A>,
</FONT></FONT></SPAN><A HREF="GreetingImpl.C">GreetingImpl.C:</A> The
server's application logic bean implementation. Here, the
implementation class is not subclassed from the POA sk<FONT FACE="DejaVu Sans, sans-serif">eleton,
namely the POA_sample::Greeting abstract class.</FONT></P>
<P STYLE="margin-bottom: 0in"><A HREF="setup.xml"><FONT FACE="DejaVu Sans, sans-serif">setup.xml:</FONT></A>
<FONT FACE="DejaVu Sans, sans-serif">This is the server's deployment
descriptor.</FONT> It describes the following server structure:</P>
<UL>
	<LI><P STYLE="margin-bottom: 0in"><FONT SIZE=2>An instance of TIE
	class POA_sample::Greeting&lt;GreetingImpl&gt; is allocated, and
	used as the servant for activating a server object. </FONT>
	</P>
	<LI><P STYLE="margin-bottom: 0in"><FONT SIZE=2>This object is
	activated on default POA (therefore, it is directly declared under
	&lt;orb&gt; element). </FONT>
	</P>
	<LI><P STYLE="margin-bottom: 0in"><FONT SIZE=2>The object element
	has an uri attribute specified. This URI value (“my-server”)
	will be used as the key_string of this object's corbaloc URL. </FONT>
	</P>
	<LI><P STYLE="margin-bottom: 0in"><FONT SIZE=2>The ORB node is
	declared with an user specified id, “<B><I>my-orb</I></B>”. This
	will let ... to generate a lazy-init'ed ORB runnner bean, with the
	id of “pocomatic.dispatcher:<B><I>my-orb</I></B>”. Initiating
	this runner bean (such as by calling
	getBean(“pocomatic.dispatcher:<B><I>my-orb</I></B>”) on the bean
	deployed factory), will start the server's request dispatching loop,
	after printing out all declared object URLs.</FONT></P>
</UL>
<H3>Building this example</H3>
<P STYLE="font-weight: medium">To build this example, the environment
variable POCOCAPSULE_DIR should point to the PocoCapsule/C++
installed directory. Also, this example assumes an underneath ORB
(e.g. VisiBroker/C++, TAO, etc.) is installed and its runtime and
development environment (such as POCOCAPSULE_DIR, VBROKER_DIR or
TAO_ROOT, etc. env variable) are set according to its product
specification. Then, this example can be built by simply invoking
gmake/make on linux/unix or nmake on windows. 
</P>
<H3>Running this example</H3>
<P><FONT FACE="Symbol">&middot; </FONT><FONT FACE="Times New Roman">Before
starting the server, make sure the LD_LIBRARY_PATH (on linux and
solaris) or the PATH (on windows) environment variable is set
correctly to include the ${POCOCAPSULE_DIR}/lib directory and the
${VBROKREDIR}/lib (if VisiBroker is used) or the ${TAO_ROOT}/lib
directory (if TAO is used).</FONT></P>
<P><FONT FACE="Symbol">&middot; </FONT><FONT FACE="Times New Roman">Start
the server:</FONT></P>
<PRE STYLE="margin-left: 0.79in; margin-bottom: 0.2in"><B>prompt&gt;</B> server </PRE><P STYLE="margin-bottom: 0.2in; font-weight: medium">
By default setting, on successful startup, server will print out all
declared corbaloc URLs (namely, &lt;object&gt; elements, with
specified uri attribute). In this server, as the object element is
declared with uri attribute equals to “<B><FONT SIZE=2><FONT FACE="Nimbus Sans L">my-server</FONT></FONT></B>”,
the print out will be, for instance:</P>
<PRE STYLE="margin-left: 0.79in"><FONT FACE="Nimbus Mono L">Server is ready, with URL:</FONT>
<FONT FACE="Nimbus Mono L">corbaloc::192.168.2.3:2809/<B>my-server</B></FONT></PRE><P>
<FONT FACE="Times New Roman"><FONT FACE="Times New Roman">Here, the
URI value “my-server” is declared in the server's deployment
descriptor <A HREF="setup.xml">setup.xml</A> file.</FONT> </FONT>
</P>
<P><FONT FACE="Times New Roman"><FONT FACE="Symbol">&middot; </FONT>Start
client: The server's corbaloc URL should be used as the first main
command line argument when starting the client. For instance: </FONT>
</P>
<PRE STYLE="margin-left: 0.79in; margin-bottom: 0.2in"><FONT FACE="Nimbus Mono L, monospace">prompt&gt; client corbaloc::192.168.2.3:2809/my-server</FONT></PRE><P>
On success, client sends a greeting message to server, and server
replies one back to client. Both sides will print out the greeting
message they received.</P>
<P><A HREF="../../README.html">Back to the root page</A></P>
</BODY>
</HTML>